package com.swust.exam.controller;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.swust.exam.pojo.Classes;
import com.swust.exam.pojo.Course;
import com.swust.exam.pojo.Students;
import com.swust.exam.service.ClassesService;
import com.swust.exam.service.CourseService;
import com.swust.exam.service.StudentsService;

@Controller
public class UserController {
	@RequestMapping(value = "/")
	public String begin(Model model)
	{	
		return "index";
	}
	
	
	@RequestMapping(value = "/introduce")
	public String introduce(Model model)
	{	
		return "introduce";
	}
	
	
	@RequestMapping(value = "/classes")
	public String classes(Model model)
	{	
		return "classes";
	}
	
	
	@Autowired ClassesService classesservice;
	@Autowired StudentsService studentsservice;
	@RequestMapping(value = "/student")
	public String student(Model model){	
		List<Students>studentslist= studentsservice.GetDetailStudentsInfo();
		model.addAttribute("studentslist",studentslist);
		List<Classes> CourseNamelist=classesservice.GetCourseName();
		model.addAttribute("CourseNamelist",CourseNamelist);
		List<Classes>classlist= classesservice.GetDetailClassInfo();
		model.addAttribute("classlist",classlist);
		return "students";
	}
	
	@Autowired
	private CourseService courseService;
	
	@RequestMapping(value = "/course")
	public String course(Model model)
	{	
		List<Course> list=courseService.courselist();
		model.addAttribute("courselist",list);
		return "course";
	}
	
	
	@RequestMapping(value = "/question")
	public String question(Model model)
	{	
		return "question";
	}
	
	@RequestMapping(value = "/exam")
	public String exam(Model model)
	{
		return "exam";
	}
	
	
	
	@RequestMapping(value = "/loginUser")
	public String loginUser(Model model)
	{
		return "loginUser";
	}


}
